uniform bool enable;
uniform sampler2D texture;
uniform float gamma;
uniform float exposure;
varying vec2 vTexCoord;
void main() {
	if(enable) {
		vec3 hdrColor = texture2D(texture, vTexCoord).rgb;
	
	    // 曝光色调映射
	    vec3 mapped = vec3(1.0) - exp(-hdrColor * exposure);
	    // Gamma校正 
	    mapped = pow(mapped, vec3(1.0 / gamma));
	
	    gl_FragColor = vec4(mapped, 1.0);
    } else {
    	gl_FragColor = texture2D(texture, vTexCoord);
    }
}